package org.groupg.mockdatabyspring.morkdata.modelDemo;

import cn.hutool.json.JSONUtil;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import org.apache.commons.io.StandardLineSeparator;
import org.groupg.mockdatabyspring.morkdata.model.DBDataFile;
import org.groupg.mockdatabyspring.morkdata.model.DBInfo.DBTableInfo;
import org.groupg.mockdatabyspring.morkdata.model.enums.ColumnType;

public class RWADemo {

    static final Log log = LogFactory.get();
    public static void main(String[] args) {

        DBTableInfo dbTableInfo1 = new DBTableInfo("FC_LOAN", "APP", "APP", "用户表");
        dbTableInfo1.addColumnInfo("DATA_DATE", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "20241231", "数据日期")
                .addColumnInfo("LOAN_REFERENCE_NO", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "[0-9]{8}", "债项编号")
                .addColumnInfo("CONT_NO", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "^HT\\d{4}(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])\\d{6}$", "借款合同编号")
                .addColumnInfo("FIN_BRANCH_NO", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "[0-9]{6}", "账务机构编号")
                .addColumnInfo("MGMT_BRANCH_NO", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "[0-9]{6}", "经营机构编号")
                .addColumnInfo("CUST_NO", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "[0-9]{8}", "客户编号")
                .addColumnInfo("CUST_NAME", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "[0-9]{8}", "客户名称")
                .addColumnInfo("CUST_TYPE", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "小微企业|中小企业|中型企业|微型企业", "客户类型")
                .addColumnInfo("PRODUCT_NO", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "1090110|[0-9]{8}", "产品编号")
                .addColumnInfo("PRODUCT_NAME", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "[0-9]{8}", "产品名称")
                .addColumnInfo("ON_OFF_FLAG", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "01|02", "表内外标识")
                .addColumnInfo("BOOK_TYPE_CD", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "B|T", "账簿类型")
                .addColumnInfo("START_DT", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "^20[1-2][0-9](0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])$", "生效日")
                .addColumnInfo("MAT_DT", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "^20[2-5][0-9](0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])$", "到期日")
                .addColumnInfo("BALANCE", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "^\\d{6,8}$", "资产余额")
                .addColumnInfo("REC_INT", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "^\\d{3,4}", "应收利息")
                .addColumnInfo("ACCR_INT", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "^\\d{3,4}", "应计利息")
                .addColumnInfo("INT_ADJ", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "^\\d{3,4}$", "利息调整")
                .addColumnInfo("FAIR_VALUE_CHANGE", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "^\\d{3,4}$", "公允价值变动")
                .addColumnInfo("RESERVE", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "^\\d{3,4}$", "计提准备金")
                .addColumnInfo("GL_ACCOUNT_ID", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "130001|140001|154001|100001", "本金科目号")
                .addColumnInfo("REC_INT_ACCOUNT", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "113001|113003|113006|100011", "应收利息科目号")
                .addColumnInfo("ACCR_INT_ACCOUNT", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "114001", "应计利息科目号")
                .addColumnInfo("INT_ADJ_ACCOUNT", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "0", "利息调整科目号")
                .addColumnInfo("FAIR_VAL_ACCOUNT", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "0", "公允价值变动科目号")
                .addColumnInfo("RESERVE_ACCOUNT", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "160001", "准备金科目号")
                .addColumnInfo("INVEST_INDUSTRY_CD", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "[a-zA-Z]", "行业投向门类")
                .addColumnInfo("INVEST_INDUSTRY_CD_1", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "[a-zA-Z][0-9]{2}", "行业投向大类")
                .addColumnInfo("INVEST_INDUSTRY_CD_2", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "房地产开发经营|[a-zA-Z][0-9]{3}", "行业投向中类")
                .addColumnInfo("INVEST_INDUSTRY_CD_3", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "[a-zA-Z][0-9]{5}", "行业投向子类")
                .addColumnInfo("PROP_DEVEL_PROJ_TYPE_CD", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "住房开发贷款|商业用房开发贷款|其他房产开发贷款|住房租赁支持贷款", "房地产开发项目类型")
                .addColumnInfo("QUALIFIED_APPROVAL_PROCEDURE", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "[0-9]{8}", "是否满足审慎贷款审批标准标志")
                .addColumnInfo("reconstruction_FLAG", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "T|F", "债务重组标识")
                .addColumnInfo("OVERDUE_DAYS", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "^\\d{1,3}$", "逾期天数")
                .addColumnInfo("FIVE_CLASS_CD", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "正常|关注|次级|可以|损失", "五级分类")
                .addColumnInfo("CCY_CD", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "CNY", "币种代码")
                .addColumnInfo("amount", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "^\\d{6,8}$", "发放金额")
                .addColumnInfo("BP_CUST_NO", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "[0-9]{8}", "核心客户号")
                .addColumnInfo("BUS_LINE", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "公司条线|小企业条线|微小条线|零售条线", "所属条线")
                .addColumnInfo("OPENING_BANK", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "[0-9]{8}", "开证行名称")
                .addColumnInfo("OPENING_BANKNO", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "[0-9]{8}", "开证行行号")
                .addColumnInfo("DOM_DOC_FLAG", ColumnType.STRING, Boolean.TRUE, Boolean.FALSE, 60, 0, "T|F", "跨境货物贸易标志")
        ;


        DBDataFile dBDataFile = DBDataFile.createUTF8Model(dbTableInfo1, "F:\\DATA\\RWA\\FC_LOAN.csv", 100000000, Boolean.TRUE, ",", StandardLineSeparator.LF.getString());
//        String jsonStr = JSONUtil.toJsonStr(DBDataFile);
        System.out.println(JSONUtil.toJsonPrettyStr(dBDataFile));
        log.debug(JSONUtil.toJsonStr(dBDataFile));
    }
}
